import { BasicColumn, FormSchema } from '@/components/Table'
import dayjs from 'dayjs'

export const searchFormSchema: FormSchema[] = [
  {
    field: 'type',
    label: '所属科室',
    slot: 'classifyId',
    colProps: { span: 6 },
  },
  {
      field: '[startDate, endDate]',
      label: '选择时间',
      component: 'RangePicker',
      colProps: { span: 6 },
      // 这里两次赋值方法有些繁琐，目前没找到更好的解决方案
      defaultValueObj: {
        startDate: dayjs().subtract(2, 'year').format('YYYY'),
        endDate: dayjs().format('YYYY'),
      },
      componentProps: {
        allowClear: false,
        picker: 'year',
        defaultValue: [
          dayjs().subtract(2, 'year').format('YYYY'),
          dayjs().format('YYYY'),
        ],
        valueFormat: 'YYYY',
      },
    },
]

export const modalSearchFormSchema: FormSchema[] = [
  {
    field: 'tag',
    label: '标签名',
    component: 'Input',
    colProps: { span: 6 },
  },
]

export const modalColumns = [
  {
    title: '标签名',
    dataIndex: 'classifyName',
  },
  {
    title: '标签描述',
    dataIndex: 'description',
  },
]

export const tableColumns:BasicColumn[] = [
  {
    title: '项目',
    dataIndex: 'tag',
    fixed: 'left'
  },
  {
    title: '年份',
    dataIndex: 'year',
    fixed: 'left',
    width: '70px'
  },
  {
    title: '单位',
    dataIndex: 'unit',
    editRow: true,
    fixed: 'left',
    width: '80px'
  },
  {
    title: '一月',
    dataIndex: 'january',
    editRow: true,
  },
  {
    title: '二月',
    dataIndex: 'february',
    editRow: true,
  },
  {
    title: '三月',
    dataIndex: 'march',
    editRow: true,
  },
  {
    title: '四月',
    dataIndex: 'april',
    editRow: true,
  },
  {
    title: '五月',
    dataIndex: 'may',
    editRow: true,
  },
  {
    title: '六月',
    dataIndex: 'june',
    editRow: true,
  },
  {
    title: '七月',
    dataIndex: 'july',
    editRow: true,
  },
  {
    title: '八月',
    dataIndex: 'august',
    editRow: true,
  },
  {
    title: '九月',
    dataIndex: 'september',
    editRow: true,
  },
  {
    title: '十月',
    dataIndex: 'october',
    editRow: true,
  },
  {
    title: '十一月',
    dataIndex: 'november',
    editRow: true,
  },
  {
    title: '十二月',
    dataIndex: 'december',
    editRow: true,
  },
  {
    title: '合计',
    dataIndex: 'total',
    fixed: 'right'
  }
]
